<template>
  <div>
    <div class="title">租赁管理</div>
    <SelectBar :routerType="true" :routerList="['/lease/list', '/lease/add']" :barData="['全部租赁', '添加租赁']"
     v-model="selectIndex" @handleSelect="handleSelect"></SelectBar>
    <router-view></router-view>
  </div>
</template>

<script>
import SelectBar from '@/components/SelectBar.vue';

export default {
  name:'LeaseManage',
  data() {
    return {
      selectIndex: 0
    }
  },
  methods:{
    handleSelect(index){
      this.selectIndex=index
    },
    
  },


  components: {
    SelectBar
  },
  watch:{
    '$route.path':{
      handler(path){
        if(path.includes('add')){
          this.handleSelect(1)
        }
        else this.handleSelect(0)
        console.log('select',this.selectIndex)
      },
      immediate:true
    }
  },
  

  
}
</script>

<style scoped>
.title{
  font-size: larger;
  margin: 10px 10px 30px 0;
  /* font-family: Microsoft YaHei; */
}
</style>